#!/bin/bash
#

# 获取当前时间
now=$(date +%s)

for proc_id in $(ps -eo pid | sed '1d'); do
    proc_start_time=$(ps -p $proc_id -o lstart=)
    proc_start_timestap=$(date -d "$proc_start_time" +%s)
    # 判断10分钟内启动的进程 
    let offset=now-proc_start_timestap 
    if [ $offset -lt 600 ]; then
       echo "进程ID：$proc_id， 进程名称: $(ps -p ${proc_id} -o comm=)"
    fi
done
